##import os
##os.system("start https://www.lanqiao.cn/problems/2406/learning/")


def check(s):
    s = hex(s)[2:]
    for i in s:
        if not 'a' <= i <= 'z':
            return False
    return True


i = 2023
while 1:
    if check(i):
        print(i)
        break
    i = i + 1
